<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <!-- 生活委员 -->
    <title>寝室考勤</title>
    <meta name="viewport" content="width=device-width,initial-scale=1" />
	<link rel="stylesheet" type="text/css" href="css/f/navs.css">
	<link rel="stylesheet" type="text/css" href="css/f/default.css">
	<link rel="stylesheet" type="text/css" href="css/f/assignment.css"/>
	<script src="js/jquery.min.js"></script>
	<script src="js/f/default.js"></script>
	<script src="js/f/cadrelife.js"></script>
	<script src="js/jquery.js"></script>
</head>

<body>
	<div class="all">
		<jsp:include page="/nav.jsp"></jsp:include>
        <div class="rightall float-left">
        	 	<div class="already">
	                <div class="already-title">
	        			<div class="left">寝室考勤</div>
	        		</div>
       			<form action="cadre/addDormCheck.do" method="post">
	                <div style="margin-top: 15px;">
	                	<span style=" margin-left:5%;"></span>
	                	学期:&nbsp;&nbsp;<input class="task" type="text" value="" name="period" style="width:10%;padding:0px 5px;" readonly/>
	                	<span style=" margin-left:5%;"></span>
	  					月份:&nbsp;&nbsp;<input class="task" type="text" value="" name="month" style="width:10%;padding:0px 5px;"/>
	                	<span style=" margin-left:5%;"></span>
	                	寝室:&nbsp;&nbsp;<select class="task" name="dormId" style="width:10%;">
		  						<c:forEach var="s" items="${dorms}">
		                       	<option value="${s.dormId}">${s.dormName}</option>
		                        </c:forEach>
	                        </select>
	                	<span style=" margin-left:5%;"></span>
	                	考勤:&nbsp;&nbsp;<select class="task" name="dormState" style="width:10%;">
	                        <option value="0">等级</option>
	                        <option value="1">良好</option>
	                    	<option value="2">优秀</option>
	                    </select>
	                	<span style=" margin-left:5%;"></span>
	                	<button type="submit" class="task btn-style" style="width:8%;" >添加</button>
	                </div>
  				</form>
       		</div>
  			<div class="already">
  				<div class="already-title">
  					<div class="left">历史考勤记录</div>
  				</div>
	                <!-- <div style="margin-top: 15px;">
	                	<span style=" margin-left:5%;"></span>
	                	学期:&nbsp;&nbsp;<input class="task" type="text" value="" name="period" style="padding:0px 5px;"/>
	                	<span style=" margin-left:5%;"></span>
	  					月份:&nbsp;&nbsp;<input class="task" type="text" value="" name="month" style="padding:0px 5px;"/>
	                	<span style=" margin-left:5%;"></span>
	                	寝室:&nbsp;&nbsp;<select class="task" name="dorm" style="width:10%;">
		  						<c:forEach var="s" items="${dorms}">
		                        	<option value="${s.dormName}">${s.dormName}</option>
		                        </c:forEach>
	                        </select>
	                	<span style=" margin-left:5%;"></span>
	                	<button class="task btn-style" style="width:18.1%;" type="submit">查找</button>
	                </div> -->
	            <table>
  					<tr class="tr-style-head">
  						<td>学期</td>
	  					<td>月份</td>
	  					<td>寝室名称</td>
	  					<td>考勤时间</td>
	  					<td>考勤</td>
  					</tr>
  					<c:forEach items="${dormCheck }" var="s">
  					<tr class="tr-style">
  						<td> ${s.checkTerm }</td>
  						<td>${s.checkMonth }</td>
	  					<td>${s.dormName }</td>
	  					<td>
	  					<fmt:formatDate value="${s.createTime }" pattern="yyyy年MM月dd日"/>
	  					</td>
	  					<td>
	  					<c:if test="${s.dormState==1 }">普通寝室</c:if>
	  					<c:if test="${s.dormState==2 }"><span style="color:blue;">优秀寝室</span></c:if>
	  					</td>
  					</tr>
  					</c:forEach>
				</table>
                <c:if test="${pages > 1 }">
               		<div class="previous">
	               		<c:if test="${pageNo>1}">
  				   		<a href="cadre/dormAttendance.do?pageNo=${pageNo-1}">上一页</a>
	                	</c:if>
	                   	<c:forEach var="p" begin="1" end="${pages }" step="1">
	                   		<c:if test="${p==pageNo }">
	                   			<span style="font-size:18px;color:#446ee6;">&nbsp;${p}&nbsp;</span>
	                   		</c:if>
	                   		<c:if test="${p!=pageNo }">
	                   			<a href="cadre/dormAttendance.do?pageNo=${p}" >&nbsp;${p}&nbsp;</a>
	                   		</c:if>
	                   	</c:forEach>
	                    <c:if test="${pageNo<pages}">
						<a href="cadre/dormAttendance.do?pageNo=${pageNo+1}">下一页</a>	   
		             	</c:if>
                   </div>
                </c:if>	
       	</div>		
 	 </div>
	</div>
</body>
</html>
